package com.eudon.user.domain.resp;

import com.eudon.user.enums.RespCode;
import lombok.Data;

/**
 * @author eudon
 * @description TODO
 * @date 2025/9/8
 * @email syd19970616@gmail.com
 * @address <a href="https://gitee.com/eudon">Gitee</a>
 */
@Data
public class BaseResp<T> {
    private int status = RespCode.SUCCESS.getCode();
    private String msg = "success";
    private T body;

    BaseResp(T body) {
        this.body = body;
    }

    BaseResp(int code, String msg) {
        this.status = code;
        this.msg = msg;
    }


    public static <T> BaseResp<T> ofSuccess(T body) {
        return new BaseResp<>(body);
    }

    public static <T> BaseResp<T> ofFail(int status, String msg) {
        return new BaseResp<>(status, msg);
    }
}
